import { defineStore } from "pinia";

export interface ITemplate {
	name: string
	fileId: string
	component: string
	dicid?: string
}

interface ISystemStore {
	template: ITemplate[]
	templateId: string
}

export const SystemStore = defineStore({
	id: 'system-store',
	state: (): ISystemStore => ({
		template: [],
		templateId: ''
	}),
	getters: {
		getTemplates(): ITemplate[] {
			return this.template
		},
		getTemplateId(): string {
			return this.templateId
		}
	},
	actions: {
		setTemplate(list: ITemplate[]) {
			this.template = list
		},
		setTemplateId(id: string) {
			this.templateId = id
		},
	}
})